//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================

namespace App.Domain.Handlers {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using App.Data;
using System.Data.Objects.SqlClient;
using App.Model;
using App.Domain.Contracts;

    public class GetBulletinPublished {
        private readonly IBulletinRepository _bulletinRepository;

        public GetBulletinPublished(IBulletinRepository bulletinRepository)
        {
            _bulletinRepository = bulletinRepository;
        }

        public IEnumerable<Bulletin> Execute() {
            try {
                return _bulletinRepository.GetAll().Where(i=>i.Published==true);
            }
            catch (InvalidOperationException ex) {
                throw new BusinessServicesException("UnableToRetrieveReminderExceptionMessage", ex);
            }
        }
    }
}
